<%--
  Created by IntelliJ IDEA.
  User: 兰宦君
  Date: 2015/10/8
  Time: 20:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<html>
<head>
  <title>后台管理系统——留言管理</title>
  <%@ include file="../../layout/import.jsp"%>

  <script type="text/javascript">
    function submit() {
      $.ajax({
        url: "/admin/processNote.do",
        data: $('#noteForm').serialize(),
        method: "POST",
        dataType: "json",
        error: function () {
          alert("表单提交出错，请稍后再试");
        },
        success: function(response) {
          if(response.code == 0) {
            alert("处理成功！");
            window.location.href = "/admin/note.do";

          }
          else {
            alert(response.description);
          }
        }
      });
    }
  </script>

</head>
<body>
<%@ include file="nav.jsp"%>

<div class="container" style="min-height: 72%">
  <div class="col-sm-8 col-sm-offset-2">

    <form class="form" id="noteForm">
        <div class="form-group">
            <input type="hidden" name="id" value="${note.id}">
        </div>
        <div class="form-group">
        <label for="userid">用户名</label>
        <label type="text" class="form-control" id="userid" name="userid">${username}</label>
      </div>

      <div class="form-group">
        <label for="subject">主题</label>
        <label type="text" class="form-control" id="subject" name="subject">${note.subject}</label>
      </div>
      <div class="form-group">
        <label for="date1">留言日期</label>
        <label type="text" class="form-control" id="date1" name="date1">${note.date1}</label>
      </div>
      <div class="form-group">
        <label for="content">内容</label>
        <label class="form-control" id="content" name="content" rows="3">${note.content}</label>
      </div>

      <div class="form-group">
        <label for="reply">处理意见</label>
        <textarea class="form-control" id="reply" name="reply" rows="3">${note.reply}</textarea>
      </div>

      <a class="btn btn-primary" onclick="submit()">提交</a>

    </form>

  </div>
</div>
